package com.angel.bo.common.msg;

import com.angel.bo.common.constant.ReturnCode;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author zhangwei
 * 统一返回封装
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class WebReturn<T> {

    public WebReturn(){
    }

    public WebReturn(Object data){
        this.data = data;
    }

    public WebReturn(String status, String msg) {
        this.msg = msg;
        this.status = status;
    }

    public WebReturn(String status, Object data, String msg) {
        this.msg = msg;
        this.status = status;
        this.data = data;
    }

    public WebReturn(String[] errorConstant) {
        this.status = errorConstant[0];
        this.msg = errorConstant[1];
    }

    public WebReturn(String msg){
        this.msg = msg;
    }

    @ApiModelProperty(value = "状态码")
    private String status = ReturnCode.OK;
    @ApiModelProperty(value = "数据")
    private Object data;
    @ApiModelProperty(value = "提示信息")
    private String msg;
    @ApiModelProperty(value = "异常信息")
    private String[] errorConstant;

}
